package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 我的受理订单信息
 */
@TableName("t_accept_order_info")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.AcceptOrderInfoMapper")
public class AcceptOrderInfoDO extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 机构主键id
     */
    @TableField(value = "org_id")
    private Long orgId;

    /**
     * 保函编号
     */
    @TableField(value = "guarantee_no")
    private String guaranteeNo;

    /**
     * 交易中心订单号
     */
    @TableField(value = "center_order_id")
    private String centerOrderId;

    /**
     * 订单时间
     */
    @TableField(value = "center_order_time")
    private String centerOrderTime;

    /**
     * 受理投保订单号：全局唯一系统规则生成
     */
    @TableField(value = "accept_order_no")
    private String acceptOrderNo;

    /**
     * 项目名称
     */
    @TableField(value = "project_name")
    private String projectName;

    /**
     * 合同/工程/标段名称
     */
    @TableField(value = "section_name")
    private String sectionName;

    /**
     * 申请企业名称
     */
    @TableField(value = "bid_customer_name")
    private String bidCustomerName;

    /**
     * 投标截止日期
     */
    @TableField(value = "bid_indate")
    private Date bidIndate;

    /**
     * 保函类型
     */
    @TableField(value = "guarantee_type")
    private String guaranteeType;

    /**
     * 保函品种
     */
    @TableField(value = "guarantee_category")
    private String guaranteeCategory;

    /**
     * 报价模板主键id
     */
    @TableField(value = "template_id")
    private Long templateId;

    /**
     * 保费金额分
     */
    @TableField(value = "guarantee_fee")
    private Long guaranteeFee;

    /**
     * 我的受理订单状态数字字典
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 出函时间
     */
    @TableField(value = "guarantee_time")
    private Date guaranteeTime;

    /**
     * 投保项目主键id
     */
    @TableField(value = "project_id")
    private Long projectId;

    /**
     * 投保客户主键id
     */
    @TableField(value = "bid_customer_id")
    private Long bidCustomerId;

    /**
     * 开函机构主键
     */
    @TableField(value = "institution_id")
    private Long institutionId;

    /**
     * 交易中心主键
     */
    @TableField(value = "center_id")
    private Long centerId;

    /**
     * 关联附件表主键id
     */
    @TableField(value = "attachment_id")
    private Long attachmentId;

    /**
     * 申请开函订单号：全局唯一
     */
    @TableField(value = "apply_order_no")
    private String applyOrderNo;

    /**
     * 开票标志 0待开票，1已开票
     */
    @TableField(value = "invoice_flag")
    private Integer invoiceFlag;

    /**
     * 发票id
     */
    @TableField(value = "invoice_id")
    private Long invoiceId;

    /**
     * 预警标识0否 1是，命中黑名单等风控
     */
    @TableField(value = "warn_flag")
    private Integer warnFlag;

    /**
     * 预警提示内容
     */
    @TableField(value = "warn_content")
    private String warnContent;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 备注说明
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 邀请码8位：配合交易中心推送信息关联
     */
    @TableField(value = "invite_code")
    private String inviteCode;

    /**
     * 委托状态 0委托中 1委托成功 2委托失败
     */
    @TableField(value = "auth_status")
    private Integer authStatus;

    /**
     * 发票号
     */
    @TableField(value = "invoice_no")
    private String invoiceNo;

    /**
     * 退保标志
     */
    @TableField(value = "revoke_flag")
    private Integer revokeFlag;

    /**
     * 统一客户统一项目出函数
     */
    @TableField(value = "guarantee_count")
    private Integer guaranteeCount;

    /**
     * 保费费率百分几例如0.01即为0.01%
     */
    @TableField(value = "fee_rate")
    private String feeRate;

    /**
     * 理赔状态0未理赔 1理赔审核中 2理赔成功 3理赔失败 4客户取消理赔
     */
    @TableField(value = "claims_status")
    private Integer claimsStatus;

    /**
     * 理赔结果备注
     */
    @TableField(value = "claims_remark")
    private String claimsRemark;

    /**
     * 下次检测支付状态时间
     */
    @TableField(value = "next_time")
    private Date nextTime;

    /**
     * 检测支付状态次数
     */
    @TableField(value = "check_times")
    private Integer checkTimes;

    /**
     * 转账支付到账时间yyyyMMdd
     */
    @TableField(value = "pay_time")
    private String payTime;

    /**
     * 退保审核时间
     */
    @TableField(value = "revoke_time")
    private Date revokeTime;

    /**
     * 解密通知次数
     */
    @TableField(value = "decrypt_notice_times")
    private Integer decryptNoticeTimes;

    /**
     * 解密通知时间
     */
    @TableField(value = "decrypt_notice_date")
    private Date decryptNoticeDate;

    /**
     * 产品代码 区分不同交易中心的费率
     */
    @TableField(value = "certify_code")
    private String certifyCode;

    /**
     * 保函文件 加密秘钥（ SM2 公钥加密）
     */
    @TableField(value = "upload_key")
    private String uploadKey;

    /**
     * 保函文件 加密子秘钥（ SM2 公钥加密）
     */
    @TableField(value = "upload_iv")
    private String uploadIv;

    /**
     * 推送中心支付结果状态0否1是
     */
    @TableField(value = "push_pay_result_flag")
    private Integer pushPayResultFlag;

    /**
     * 客户端ID
     */
    @TableField(value = "client_id")
    private String clientId;

    /**
     * 厦门申请标识ID
     */
    @TableField(value = "center_apply_id")
    private String centerApplyId;

    /**
     * 发票种类：bs:电子发票(增值税专用发票)-即数电专票(电子),pc:电子发票(普通发票)-即数电普票(电子)
     */
    @TableField(value = "invoice_line")
    private String invoiceLine;

    /**
     * 密文，JSON格式
     */
    @TableField(value = "ciphertext")
    private String ciphertext;

    /**
     * 记账子单元编号
     */
    @TableField(value = "sub_account")
    private String subAccount;

    /**
     * 收款虚拟卡号(中信银行)
     */
    @TableField("virtual_card_no")
    private String virtualCardNo;

    /**
     * 开卡时客户流水号(中信银行)
     */
    @TableField("card_client_id")
    private String cardClientId;

    /**
     * 虚拟卡状态 (ACTIVE:使用中, CLOSED:已关闭)
     */
    @TableField("card_status")
    private String cardStatus;
    public AcceptOrderInfoVo buildVo() {
        return new AcceptOrderInfoVo(id, orgId, guaranteeNo, centerOrderId, centerOrderTime, acceptOrderNo, projectName, sectionName, bidCustomerName, bidIndate, guaranteeType, guaranteeCategory, templateId, guaranteeFee, status, guaranteeTime, projectId, bidCustomerId, institutionId, centerId, attachmentId, applyOrderNo, invoiceFlag, invoiceId, warnFlag, warnContent, gmtCreate, gmtModified, userCreate, userModified, remark, inviteCode, authStatus, invoiceNo, revokeFlag, guaranteeCount, feeRate, claimsStatus, claimsRemark, nextTime, checkTimes, payTime, revokeTime, decryptNoticeTimes, decryptNoticeDate, certifyCode, uploadKey, uploadIv, pushPayResultFlag, clientId, centerApplyId, invoiceLine, ciphertext, subAccount, virtualCardNo, cardClientId, cardStatus);
    }

    public static AcceptOrderInfoDO of(AcceptOrderInfoVo vo) {
        return new AcceptOrderInfoDO(vo.getId(), vo.getOrgId(), vo.getGuaranteeNo(), vo.getCenterOrderId(), vo.getCenterOrderTime(), vo.getAcceptOrderNo(), vo.getProjectName(), vo.getSectionName(), vo.getBidCustomerName(), vo.getBidIndate(), vo.getGuaranteeType(), vo.getGuaranteeCategory(), vo.getTemplateId(), vo.getGuaranteeFee(), vo.getStatus(), vo.getGuaranteeTime(), vo.getProjectId(), vo.getBidCustomerId(), vo.getInstitutionId(), vo.getCenterId(), vo.getAttachmentId(), vo.getApplyOrderNo(), vo.getInvoiceFlag(), vo.getInvoiceId(), vo.getWarnFlag(), vo.getWarnContent(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getRemark(), vo.getInviteCode(), vo.getAuthStatus(), vo.getInvoiceNo(), vo.getRevokeFlag(), vo.getGuaranteeCount(), vo.getFeeRate(), vo.getClaimsStatus(), vo.getClaimsRemark(), vo.getNextTime(), vo.getCheckTimes(), vo.getPayTime(), vo.getRevokeTime(), vo.getDecryptNoticeTimes(), vo.getDecryptNoticeDate(), vo.getCertifyCode(), vo.getUploadKey(), vo.getUploadIv(), vo.getPushPayResultFlag(), vo.getClientId(), vo.getCenterApplyId(),vo.getInvoiceLine(),vo.getCiphertext(),vo.getSubAccount(), vo.getVirtualCardNo(), vo.getCardClientId(), vo.getCardStatus());
    }
}
